package zuoye;

import util.Util;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Loginjpanel extends JPanel implements ActionListener {
    private Icon loginimage = Util.getIcon("/images/buttonLand.jpg");
    private Icon offimage = Util.getIcon("/images/buttonOff.jpg");
    private JButton jButton;
    private JButton jButton1;
    private Mainjframe frame;

    public Loginjpanel(Mainjframe frame) {
        this.frame = frame;
        this.setLayout(null);
        this.setOpaque(false);
        jButton = new JButton(loginimage);
        jButton.setBounds(250, 480, 140, 50);
        this.add(jButton);
        jButton.addActionListener(this);
        jButton1 = new JButton(offimage);
        jButton1.setBounds(810, 480, 140, 50);
        this.add(jButton1);
        jButton1.addActionListener(this);
    }


    @Override
    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == jButton) {
            frame.switchPanel("menu");
        } else if (e.getSource() == jButton1){
            System.exit(0);
        }
    }
}
